package com.wuming.caiwu.util;

import com.wuming.caiwu.core.StudentClaimStatus;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class ExamScoreUtil {
    private static Map<String, String> itemMap = new HashMap<>();

    static {
        itemMap.put("1", "科目一");
        itemMap.put("2", "科目二");
        itemMap.put("3", "科目三道路驾驶");
        itemMap.put("4", "科目三安全文明");
    }

    public static int getExamStatus(String itemName, int examScore) {
        if (StringUtils.contains(itemName, "科目一") && examScore >= 90) {
            return 1;
        }
        if (StringUtils.contains(itemName, "科目二") && examScore >= 80) {
            return 1;
        }
        if (StringUtils.contains(itemName, "道路驾驶") && examScore >= 90) {
            return 1;
        }
        if (StringUtils.contains(itemName, "安全文明") && examScore >= 90) {
            return 1;
        }
        return 0;
    }

    public static int getExamStatus(int item, int examScore) {
        if (item == 1 && examScore >= 90) {
            return 1;
        }
        if (item == 2 && examScore >= 80) {
            return 1;
        }
        if (item == 3 && examScore >= 90) {
            return 1;
        }
        if (item == 4 && examScore >= 90) {
            return 1;
        }
        return 0;
    }

    public static String getStatusString(int status) {
        if (status == StudentClaimStatus.WAIT_CLAIM.ordinal()) {
            return "待理赔";
        } else if (status == StudentClaimStatus.CLAIMING.ordinal()) {
            return "理赔中";
        } else if (status == StudentClaimStatus.CLAIM_COMPLETE.ordinal()) {
            return "理赔完成";
        } else if (status == StudentClaimStatus.CLAIM_FAILURE.ordinal()) {
            return "理赔失败";
        } else if (status == StudentClaimStatus.DATA_AUDITING.ordinal()) {
            return "资料审核中";
        }
        return "";
    }

    public static String getInsuranceStatusString(int status) {
        if (status == 0) {
            return "未审核";
        } else if (status == 1) {
            return "核保中";
        } else if (status == 2) {
            return "核保通过";
        } else if (status == 3) {
            return "保障中";
        } else {
            return "";
        }
    }

    public static Map<String, String> getItemMap() {
        return itemMap;
    }
}
